﻿<UserControl
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit" xmlns:System="clr-namespace:System;assembly=mscorlib" x:Class="ClientOverflow.UserControls.PostQuestion" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <TextBlock Text="Title" Grid.Row="0" Grid.Column="0" />
        <TextBox Text="{Binding Title, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" Grid.Row="0" Grid.Column="1" />
        <TextBlock Text="Content" Grid.Row="1" Grid.Column="0" />
        <TextBox Text="{Binding Content, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" Grid.Row="1" Grid.Column="1"  AcceptsReturn="True" MinWidth="350" MinHeight="200"/>
        <TextBlock Text="Tags" Grid.Row="2" />
        <StackPanel Grid.Column="1" Grid.Row="2" Orientation="Horizontal">
            <toolkit:AutoCompleteBox ItemsSource="{Binding AllTags}" Text="{Binding Tags[0].Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Background="{DynamicResource ControlBackgroundBrush}" Foreground="{DynamicResource TextBrush}" />
            <toolkit:AutoCompleteBox ItemsSource="{Binding AllTags}" Text="{Binding Tags[1].Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Background="{DynamicResource ControlBackgroundBrush}" Foreground="{DynamicResource TextBrush}" />
            <toolkit:AutoCompleteBox ItemsSource="{Binding AllTags}" Text="{Binding Tags[2].Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Background="{DynamicResource ControlBackgroundBrush}" Foreground="{DynamicResource TextBrush}" />
            <toolkit:AutoCompleteBox ItemsSource="{Binding AllTags}" Text="{Binding Tags[3].Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Background="{DynamicResource ControlBackgroundBrush}" Foreground="{DynamicResource TextBrush}" />
            <toolkit:AutoCompleteBox ItemsSource="{Binding AllTags}" Text="{Binding Tags[4].Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Background="{DynamicResource ControlBackgroundBrush}" Foreground="{DynamicResource TextBrush}" />
        </StackPanel>
<!--
        <DataGrid ItemsSource="{Binding Tags}" Grid.Column="1" Grid.Row="2" AutoGenerateColumns="False">
            <DataGrid.Columns>
                <DataGridTemplateColumn> 
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <toolkit:AutoCompleteBox ItemsSource="{Binding DataContext.AllTags, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>            
        </DataGrid>
-->
<!--        <Button Content="Add" Grid.Row="3" Padding="5" Command="{Binding AddTag}" />-->
        <Button Command="{Binding Save}" Content="Save" Grid.Row="3" Padding="5" Grid.Column="1" HorizontalAlignment="Right"/>
    </Grid>
</UserControl>
